fix(patch): cherry-pick ab6b229 to release/v0.16.0-preview.2-pr-13101 to patch version v0.16.0-preview.2 and create version 0.16.0-preview.3#13110
Conversation
Summary of ChangesHello @gemini-cli-robot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request, an automated cherry-pick, enhances the CLI's user interface by adding detailed mouse button state tracking to mouse events. This improvement allows for more accurate differentiation between various mouse interactions, such as simple movement versus drag operations, leading to more robust and precise handling of user input within the terminal UI components. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a button property to mouse events to distinguish between different mouse buttons during events like drags. The implementation correctly adds this property to the MouseEvent interface and updates parsing logic and tests. However, I found a high-severity issue where scroll events are incorrectly assigned a button (e.g., 'left' for scroll-up) instead of 'none'. This occurs in both SGR and X11 mouse event parsing logic. I've provided suggestions to fix this and recommended updating the tests to cover these cases.
| shift, | ||
| col, | ||
| row, | ||
| button: getButtonFromCode(buttonCode), |
There was a problem hiding this comment.
For scroll events, the button property is being incorrectly assigned based on the event code. For example, a scroll-up event (code 64) will result in button: 'left' because 64 & 3 is 0. Scroll events should have button: 'none'. You should also update the parses SGR scroll events test in packages/cli/src/ui/utils/mouse.test.ts to assert that event.button is 'none'.
| button: getButtonFromCode(buttonCode), | |
| button: name.startsWith('scroll-') ? 'none' : getButtonFromCode(buttonCode), |
| let button = getButtonFromCode(b); | ||
| if (name === 'left-release' && button === 'none') { | ||
| button = 'left'; | ||
| } |
There was a problem hiding this comment.
Similar to the SGR parsing, scroll events in X11 mode are being assigned a button incorrectly. For example, a scroll-up event will be assigned button: 'left'. Scroll events should have button: 'none'. You should also consider adding a test for X11 scroll events in packages/cli/src/ui/utils/mouse.test.ts and assert that event.button is 'none'.
let button: MouseEvent['button'];
if (name.startsWith('scroll-')) {
button = 'none';
} else {
button = getButtonFromCode(b);
if (name === 'left-release' && button === 'none') {
button = 'left';
}
}|
Size Change: +495 B (0%) Total Size: 20.5 MB ℹ️ View Unchanged
|
6f34e25
into
release/v0.16.0-preview.2-pr-13101

This PR automatically cherry-picks commit ab6b229 to patch version v0.16.0-preview.2 in the preview release to create version 0.16.0-preview.3.